_package("alz.test");

_import("alz.core.Application");
_import("alz.mui.ScrollView");

/**
 * 滚动视图组件测试
 */
_class("AppTest", Application, function(){
	this._init = function(){
		_super._init.call(this);
		this._view = null;
	};
	this.init = function(){
		_super.init.apply(this);
		runtime._workspace._self.innerHTML = '<div class="wui-Workspace">'
			+ '<div class="scrollview" id="scrollview1" style="left:0px;top:0px;"><div class="scroller"></div></div>'
			+ '<div class="scrollview" id="scrollview2" style="left:240px;top:0px;"><div class="scroller"></div></div>'
			+ '</div>';
		this.initScroll($E("scrollview1").childNodes[0]);
		this.initScroll($E("scrollview2").childNodes[0]);
		this._view = new ScrollView();
		this._view.bind($E("scrollview1"));
		var myScroll = new iScroll($E("scrollview2").childNodes[0], {"desktopCompatibility": true});
	};
	this.dispose = function(){
		this._view.dispose();
		this._view = null;
		_super.dispose.apply(this);
	};
	this.initScroll = function(parent){
		for(var i = 0, len = 100; i < len; i++){
			var p = document.createElement("p");
			/*
			p.style.position = "absolute";
			p.style.width = "200px";
			p.style.left = "0px";
			p.style.top = (i * 20) + "px";
			*/
			p.style.backgroundColor = i % 2 == 0 ? "#FFFFFF" : "#DDDDDD";
			p.innerHTML = i + "abcdefghijklmnopqrstuvwxyz0123456789";
			parent.appendChild(p);
			p = null;
		}
	};
});